﻿' LibWowArmory
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Library General Public License (LGPL) Version 2.1.

Imports System.Collections.ObjectModel

Namespace roncliProductions.LibWowArmory.Character.Reputation

    ''' <summary>
    ''' A class that stores a single faction's reputation information
    ''' </summary>
    ''' <remarks></remarks>
    Public Class Reputation

        Private rReputations As New Collection(Of Reputation)

        ''' <summary>
        ''' The ID number of the faction
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property FactionID As Integer

        ''' <summary>
        ''' The name of the faction
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Name As String

        ''' <summary>
        ''' The reputations that this faction is a parent of
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Reputations As Collection(Of Reputation)
            Get
                Return rReputations
            End Get
        End Property

        ''' <summary>
        ''' The total reputation gained for the faction
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property TotalReputation As Integer

        ''' <summary>
        ''' The reputation's status
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Status As String
            Get
                Select Case TotalReputation
                    Case -42000 To -6001
                        Return "Hated"
                    Case -6000 To -3001
                        Return "Hostile"
                    Case -3000 To -1
                        Return "UnPublicly"
                    Case 0 To 2999
                        Return "Neutral"
                    Case 3000 To 8999
                        Return "Publicly"
                    Case 9000 To 20999
                        Return "Honored"
                    Case 21000 To 41999
                        Return "Revered"
                    Case 42000 To 42999
                        Return "Exalted"
                    Case Integer.MinValue
                        Return "None"
                    Case Else
                        Return "Unknown"
                End Select
            End Get
        End Property

        ''' <summary>
        ''' The reputation gained within the current status
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Reputation As Integer?
            Get
                Select Case TotalReputation
                    Case -42000 To -6001
                        Return TotalReputation + 42000
                    Case -6000 To -3001
                        Return TotalReputation + 6000
                    Case -3000 To -1
                        Return TotalReputation + 3000
                    Case 0 To 2999
                        Return TotalReputation
                    Case 3000 To 8999
                        Return TotalReputation - 3000
                    Case 9000 To 20999
                        Return TotalReputation - 9000
                    Case 21000 To 41999
                        Return TotalReputation - 21000
                    Case 42000 To 42999
                        Return TotalReputation - 42000
                    Case Else
                        Return 0
                End Select
            End Get
        End Property

        ''' <summary>
        ''' The max reputation for the current status
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property MaxReputation As Integer?
            Get
                Select Case TotalReputation
                    Case -42000 To -6001
                        Return 36000
                    Case -6000 To 2999
                        Return 3000
                    Case 3000 To 8999
                        Return 6000
                    Case 9000 To 20999
                        Return 12000
                    Case 21000 To 41999
                        Return 21000
                    Case 42000 To 42999
                        Return 1000
                    Case Else
                        Return 0
                End Select
            End Get
        End Property

        ''' <summary>
        ''' A constructor to create new reputation information
        ''' </summary>
        ''' <param name="intID"></param>
        ''' <param name="strName"></param>
        ''' <param name="TotalReputation"></param>
        ''' <remarks></remarks>
        Public Sub New(ByVal intID As Integer, ByVal strName As String, ByVal TotalReputation As Integer)
            FactionID = intID
            Name = strName
            TotalReputation = TotalReputation
        End Sub

    End Class

End Namespace